<?php /*a:6:{s:55:"E:\code\jiaoyou\application\admin\view\content\add.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\header.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\css.html";i:1598939754;s:53:"E:\code\jiaoyou\application\admin\view\public\js.html";i:1598939754;s:57:"E:\code\jiaoyou\application\admin\view\public\footer.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\bottom.html";i:1598939754;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>后台系统</title>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/animate.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/style.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/ffxiang.css" />
<link rel="shortcut icon" href="http://jiaoyou.com\/style/admin/img/favicon.ico">
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/layui/css/layui.css" />
</head>
<style type="text/css">
    .gray-bg {
        background: #fff;
    }

    .wrapper {
        padding: 0;
    }

    .image-item {
        margin-bottom: 20px;
        height: 284px;
        overflow: hidden;
    }

    .image-item div {
        width: 100%;
        overflow: hidden;
    }

    .image-item .img-top {
        height: 145px;
    }

    .image-item .img-bottom {
        margin-top: 8px;
        height: 43px;
    }

    .image-item .img-bottom select {
        width: 50%;
    }

    .image-item div img {
        width: 100%;
    }

    .image-item button {
        position: absolute;
        right: 15px;
        display: block;
    }

    #images-item {
        margin-left: 100px;
        margin-right: 100px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <form class="form-horizontal" method="post">
            <div class="col-sm-12">
                <div class="ibox-content">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">类型：</label>
                        <div class="col-sm-9">
                            <select name="type" class="form-control">
                                <?php foreach($config['type'] as $key => $item): ?>
                                <option value="<?php echo htmlentities($key); ?>" <?php if(isset($name['type']) and $name['type'] == $key): ?>selected="selected"
                                        <?php endif; ?>><?php echo htmlentities($item); ?></option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分类：</label>
                        <div class="col-sm-9">
                            <select name="category_id" class="form-control">
                                <option value="">请选择分类...</option>
                                <?php foreach($config['category'] as $key => $item): ?>
                                <option value="<?php echo htmlentities($item['id']); ?>" {if isset($name.category_id) and $name.category_id eq
                                        $item.id}selected="selected" {
                                /if}><?php echo htmlentities($item['name']); ?></option>
                                <?php endforeach; ?>
                            </select>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 发布系统广播无需选择</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">置顶：</label>
                        <div class="col-sm-9">
                            <select name="is_top" class="form-control">
                                <option value="0">否</option>
                                <option value="1" {if isset($name.is_top) and $name.is_top eq 1}selected="selected" {
                                /if}>是</option>
                            </select>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 置顶将按发布时间从新到旧排序</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">用户ID：</label>
                        <div class="col-sm-9">
                            <input type="text" name="member_id" class="form-control"
                                   value="<?php if(!empty($name['member_id'])): ?><?php echo htmlentities($name['member_id']); ?><?php endif; ?>"
                                   onkeyup="this.value = this.value.replace(/[^\d]/g,'')"/>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 发布系统广播无需填写</span>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">范围选择：</label>
                        <div class="col-sm-9">
                            <select id="choose" name="choose" class="form-control">
                                <option value="1" <?php if(isset($name['date_type']) && $name['date_type'] != -1): ?> selected="selected"<?php endif; ?>>选择</option>
                                <option value="2" <?php if(empty($name['date_type']) || $name['date_type'] == -1): ?> selected="selected" <?php endif; ?>>填写</option>

                            </select>
                        </div>
                    </div>



                    <div class="form-group date_time" id="date_time_1" <?php if(empty($name['date_type']) ||  $name['date_type'] == -1): ?> style="display: none;"<?php endif; ?>>
                        <label class="col-sm-2 control-label">时间：</label>
                        <div class="col-sm-4">
                            <input type="text" name="date" class="layui-input" value="<?php if(!empty($name['begin_date'])): ?><?php echo htmlentities(date('Y-m-d',!is_numeric($name['begin_date'])? strtotime($name['begin_date']) : $name['begin_date'])); ?><?php endif; ?>" id="date" placeholder="开始时间">
                        </div>
                        <div class="col-sm-5">
                            <select name="date_type" class="form-control">
                                <?php foreach($choose_list as $key => $item): ?>
                                <option value="<?php echo htmlentities($key); ?>" <?php if(!empty($name['date_type']) && $name['date_type'] == $key): ?> selected="selected" <?php endif; ?>><?php echo htmlentities($item['name']); ?></option>
                                <?php endforeach; ?>
                            </select>
                        </div>

                    </div>

                    <div class="form-group date_time" <?php if(isset($name['date_type']) && $name['date_type'] != -1): ?> style="display: none;"<?php endif; ?>id="date_time_2">
                        <label class="col-sm-2 control-label">时间范围：</label>
                        <div class="col-sm-4">
                            <input type="text" name="begin_date" class="layui-input" id="begin_date" value="<?php if(!empty($name['begin_date'])): ?><?php echo htmlentities(date('Y-m-d H:i:s',!is_numeric($name['begin_date'])? strtotime($name['begin_date']) : $name['begin_date'])); ?><?php endif; ?>" placeholder="开始时间">
                        </div>
                        <div class="col-sm-4">
                            <input type="text" name="end_date" class="layui-input" id="end_time"  value="<?php if(!empty($name['end_date'])): ?><?php echo htmlentities(date('Y-m-d H:i:s',!is_numeric($name['end_date'])? strtotime($name['end_date']) : $name['end_date'])); ?><?php endif; ?>" placeholder="结束时间">
                        </div>
                        <div class="col-sm-1">
                            &nbsp;
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">地点：</label>
                        <div class="col-sm-9">
                            <input type="text" name="location" class="form-control" placeholder="地点（例如：广州市）"
                                   value="<?php echo htmlentities((isset($name['location']) && ($name['location'] !== '')?$name['location']:"")); ?>" />
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 发布系统广播无需填写</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">内容：</label>
                        <div class="col-sm-9">
                            <textarea name="content" class="form-control" rows="3"
                                      cols="20"><?php echo htmlentities((isset($name['content']) && ($name['content'] !== '')?$name['content']:"")); ?></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">图片集：</label>
                        <div class="col-sm-9">
                            <div id="demo"></div>
                        </div>
                    </div>
                    <input type="hidden" name="id" value="<?php echo htmlentities((isset($name['id']) && ($name['id'] !== '')?$name['id']:" 0")); ?>" />
                    <input type="hidden" name="image_ids" value="<?php echo implode(',', array_keys($file)); ?>"/>
                    <div class="form-group" id="images-item">
                        <?php foreach($file as $id => $item): ?>
                        <div class="col-md-3 col-sm-4 col-xs-6 image-item" id="file<?php echo htmlentities($id); ?>">
                            <button type="button" class="btn btn btn-sm btn-danger" onclick="delImg(<?php echo htmlentities($id); ?>)"><i
                                    class="fa fa-trash"></i> 删除
                            </button>
                            <div class="img-top"><img src="<?php echo htmlentities($item['url']); ?>"/></div>
                            <div class="img-bottom">
                                <label class="col-sm-6 control-label">图片状态：</label>
                                <select class="form-control" name="file[<?php echo htmlentities($id); ?>][status]">
                                    <option value="1">正常</option>
                                    <option value="2" <?php if($item['status'] == 2): ?>selected="selected" <?php endif; ?>>违规</option>
                                </select>
                            </div>
                            <textarea style="resize:none;" class="form-control" name="file[<?php echo htmlentities($id); ?>][remark]" rows="3"><?php echo htmlentities($item['remark']); ?></textarea>
                        </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
     
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/content.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.css" />
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/ffxiangIndex.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/common.js"></script>
</body>
</html>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/iCheck/icheck.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/iCheck/custom.css" />
<!-- 引用控制层插件样式 -->
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/zyUpload/zyUpload.css" />
<!-- 引用核心层插件 -->
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/zyUpload/zyUpload.js"></script>
<script type="text/javascript">
    layui.use('laydate', function () {
        //时间选择器
        layui.laydate.render({
            elem: '#begin_date'
            , type: 'datetime'
        });
        layui.laydate.render({
            elem: '#end_time'
            , type: 'datetime'
        });
        layui.laydate.render({
            elem: '#date'
        });
    });
    var urlupload = "<?php echo url('file/uploadImages', ['path' => 'content', 'fileType' => 5]); ?>";

    function callback(res) {
        var html = '<div class="col-md-3 col-sm-4 col-xs-6 image-item" id="file' + res.id + '">';
        html += '<button type="button" class="btn btn btn-sm btn-danger" onclick="delImg(' + res.id + ')"><i class="fa fa-trash"></i> 删除</button>';
        html += '<div class="img-top"><img src="' + res.img + '" /></div>';
        html += '<div class="img-bottom">';
        html += '<label class="col-sm-6 control-label">图片状态：</label>';
        html += '<select class="form-control" name="file[' + res.id + '][status]">';
        html += '<option value="1">正常</option><option value="2">违规</option>';
        html += '</select>';
        html += '</div>';
        html += '<textarea style="resize:none;" class="form-control" name="file[' + res.id + '][remark]" rows="3"></textarea>';
        html += '</div>';
        $("#images-item").append(html);
        var image_ids = $("input[name='image_ids']").val();
        if (image_ids.length > 0) image_ids += ',';
        image_ids += res.id;
        $("input[name='image_ids']").val(image_ids);
    }

    function delImg(id) {
        layer.confirm('是否删除该照片', {
            btn: ['确定', '取消']
        }, function (index) {
            layer.close(index);
            $("#images-item").find('#file' + id).remove();
        });
    }

    $("#choose").change(function () {
        var choose_val = $(this).val();
        $(".date_time").hide();
        $("#date_time_" + choose_val).show();
    });

</script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/zyUpload/script.js?ver=20200527"></script>
<script type="text/javascript">
$(document).ready(function(){
    $("#button").click(function(){

      <?php 
      if((request()->controller()=='Article' && request()->action()=='add') || (request()->controller()=='Shop' && request()->action()=='add')){
       ?>

      var images='';
      <?php if(!empty($name)){ ?>
      $(".meiyouuimmag textarea").each(function(ret){
        var img=$(this).data('img');
        if(img){
          img_text=$(this).val();
          if(ret==0){
            images+='"'+img
          }else{
            images+=',"'+img
          }
        }
      });
      if(images){
        images="{"+images+"}";
        $('#images').val(images);
      }else{
        $('#images').val();
      }

      <?php }else{?>
       $(".meiyouuimmag textarea").each(function(ret){
        var img=$(this).data('img');
        if(img){
          img_text=$(this).val();
          if(ret==0){
            images+=''+img
          }else{
            images+=','+img
          }
        }
      });
      if(images){
        $('#images').val(images);
      }else{
        $('#images').val();
      }
        <?php }} 
if(input('?url')){
  echo 'loading("#button button")'."\r\n";
}
 ?>

        ajaxFun("POST","",$(".form-horizontal").serialize(),"json",function(ret){
            if(ret){
                if(ret.ret){
                    swal_msg(ret.ret,'',"success",<?php if(input('?url')){echo input('url');}else{echo 0;} ?>)
                    <?php 
if(input('?url')){
  echo 'loading("#button button",\'<i class="fa fa-check"></i> &nbsp;\'+ret.ret)';
}
 ?>

                    return false;
                }else{
                    layer.msg(ret.err)
                }
            }else{
                swal_msg("错误",ret,"error");
            }
            <?php 
if(input('?url')){
 ?>
loadingClose("#button button",'<i class="fa fa-check"></i> &nbsp;<?php if(isset($name)): ?>修改<?php else: ?>提交<?php endif; ?>')
<?php 
}
 ?>

        });
    });
});

function html2Escape(sHtml) {
 return sHtml.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});
}
</script>
<style type="text/css">
.tbutton{ 
  position: fixed;
  bottom:0px;
  width: 100%;
  background: #fff;
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 1px solid #F5EFEF;
  z-index: 99999999999
}
#button{ width:120px; margin: 0 auto;}
.wrapper-content{ margin-bottom:75px;}
</style>

<div class="tbutton">
  <div id="button"><button class="btn btn-w-m btn-primary" type="button"><i class="fa fa-check"></i> &nbsp;<?php if(isset($name)): ?>修改<?php else: ?>提交<?php endif; ?></button></div>
</div>